home *** CD-ROM | disk | FTP | other *** search
/ Aminet 16 / Aminet 16 (1996)(GTI - Schatztruhe)[!][Dec 1996].iso / Aminet / util / batch / random.readme < prev    next >
Text File  |  1996-11-04  |  3KB  |  105 lines

  1. Short:    Output a random number for use in scripts, etc.
  2. Author:   krf101@york.ac.uk (Kevin Fairhurst)
  3. Uploader: krf101@york.ac.uk (Kevin Fairhurst)
  4. Type:     util/batch
  5.  
  6.  
  7. Usage:
  8.  
  9.    The correct usage of 'Random' is to pass it a single argument. This value
  10. is the maximum number you want considered i.e. that a random number will be
  11. picked between 1 and this number.
  12.  
  13.    For 'Random' to work correctly, the number MUST be between 1 and 65536.
  14. Numbers outside this range (or failure to pass numbers, eg passing
  15. a string of letters) will cause 'Random' to behave as outlined in the
  16. examples that follow:
  17.  
  18. 1> Random
  19.  
  20.       outputs a number between 1 and 65536
  21.  
  22. 2> Random 0
  23.  
  24.       same as example 1
  25.  
  26. 3> Random a  (where 'a' is a positive integer between 1 and 65536 inclusive)
  27.  
  28.       outputs a number between 1 and a
  29.  
  30. 4> Random b   (where 'b' is a positive integer greater than 65536)
  31.  
  32.       outputs the number 1
  33.  
  34. 5> Random c   (where 'c' is any negative integer)
  35.  
  36.       outputs c + 1
  37.  
  38. 6> Random text
  39.  
  40.       same as example 1
  41.  
  42. 7> Random 123 456 789
  43.  
  44.       outputs a number between 1 and the first argument (in this case 123)
  45.  
  46. 8> Random "more text"
  47.  
  48.       same as example 1
  49.  
  50. 9> Random "123 456 789"
  51.  
  52.       same as example 1
  53.  
  54.  
  55.    What you do once you have your random number is up to you. One idea is if
  56. you want random backdrops.  Say you have 5 different backdrop settings that
  57. you wish to choose from at every boot. Save them to prefs/presets with
  58. different filenames (WBPattern_1.prefs, etc. would be a good start). Then
  59. edit 5 scripts in your S: drawer, named 1.bat to 5.bat.
  60.  
  61.    Script 1.bat copies WBPattern_1.prefs to env:sys/WBPattern.prefs, and I
  62. hope I don't have to tell you what 2.bat - 5.bat do ...
  63.  
  64.    AFTER everything has been copied from ENVARC:SYS to ENV:SYS in your
  65. startup-sequence, but before IPrefs is called, add the following lines:
  66.  
  67.       Random 5 >ENV:WBP
  68.       Run <>NIL: Execute S:$WBP.bat
  69.  
  70. (For those who don't know, using <>NIL: is the same as using <NIL: >NIL:)
  71.  
  72.    As long as you have 'Random' in your path somewhere, along with Run and
  73. Execute, every time you boot your backdrop settings will be chosen randomly!
  74.  
  75.    Other ideas are to incorperate the RequestChoice command to have a dead
  76. good (honest!) game.  See the file Game.bat which should have come with this
  77. program for an example of this.
  78.  
  79.  
  80. -->8--------------------------------------------------------------------8<--
  81.  
  82.    If you wish to complain/comment/send cash then either email me at the
  83. above address, or write to me at
  84.  
  85.    Kevin Fairhurst
  86.    Goodricke College
  87.    University of York
  88.    Heslington
  89.    York
  90.    YO1 5DD
  91.    England
  92.  
  93.    Also, check out my homepage on http://www.york.ac.uk/~krf101
  94.  
  95.  
  96. ============================= Archive contents =============================
  97.  
  98. Original  Packed Ratio    Date     Time    Name
  99. -------- ------- ----- --------- --------  -------------
  100.     1226     570 53.5% 17-Sep-96 13:46:04  Game.bat
  101.     1256     953 24.1% 17-Sep-96 11:07:58  Random
  102.     2675    1245 53.4% 17-Sep-96 11:42:38  Random.readme
  103. -------- ------- ----- --------- --------
  104.     5157    2768 46.3% 14-Oct-96 07:00:24   3 files
  105.